//
//  DetailTableViewCell.m
//  X-Touch2
//
//  Created by shengchao yang on 12-3-28.
//  Copyright (c) 2012年 foxhis. All rights reserved.
//

#import "DetailTableViewCell.h"
#import "DetailTableViewCellController.h"
#import "RemoteDishes.h"
#import "Common.h"

@implementation DetailTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        DetailTableViewCellController *cellController = [[[DetailTableViewCellController alloc] initWithNibName:@"DetailTableViewCellController" bundle:nil] autorelease];
        [self.contentView addSubview:cellController.view];
        
        lblName = (UILabel *)[self viewWithTag:TagOfUILabel];
        lblCook = (UILabel *)[self viewWithTag:TagOfUILabel+1];
        lblNumber = (UILabel *)[self viewWithTag:TagOfUILabel+2];
        lblPrice = (UILabel *)[self viewWithTag:TagOfUILabel+3];
        lblAmount = (UILabel *)[self viewWithTag:TagOfUILabel+4];
    }
    return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated{
    [super setSelected:selected animated:animated];
    UIImageView *imageView = (UIImageView *)[self viewWithTag:TagOfUIImageView];
    if (selected) {
        imageView.hidden = NO;
    }else {
        imageView.hidden = YES;
    }
}

-(void) setData:(id)data{
    RemoteDishes *temp = (RemoteDishes *)data;
    lblName.text = JsonField(temp.rdDescripts);
    lblCook.text = temp.rdCook;
    lblNumber.text = NumberFormatter(temp.rdNumber);
    lblPrice.text = PriceFormatter(temp.rdPrice,JsonField(temp.rdUnits));
    lblAmount.text = temp.rdAmount;
}

-(void) dealloc{
    [super dealloc];
}

@end
